/**
 * @param {number[]} nums1
 * @param {number[]} nums2
 * @param {number[][]} queries
 * @return {number[]}
 */
var handleQuery = function (nums1, nums2, queries) {
  let res = []
  for (let i = 0; i < queries.length; i++) {
    const [first, second, third] = queries[i]
    if (first == 1) {
      for (let left = second; left <= third; left++) {
        nums1[left] = Number(!nums1[left])
      }
    } else if (first == 2) {
      for (let i = 0; i < nums2.length; i++) {
        nums2[i] = nums2[i] + nums1[i] * second
      }
    } else {
      let sum = 0
     console.log( nums2.reduce((pre, cur) => pre + cur, sum));
      res.push(sum)
    }
  }
  return res
};
handleQuery([1, 0, 1], [0, 0, 0], [[1, 1, 1], [2, 1, 0], [3, 0, 0]])